// pages/detail/detail.js
Page({
  data: {
    message: {}
  },

  onLoad: function (options) {
    const id = options.id;
    const message = this.getMessageDetail(id);
    this.setData({ message });
  },

  getMessageDetail: function (id) {
    const messages = [
      { id: 1, title: '系统通知', time: '2025-7-01 10:00', content: '欢迎使用我们的服务！' },
      { id: 2, title: '新消息提醒', time: '2025-7-01 11:00', content: '您有一条新消息，请查收。' },
      { id: 3, title: '活动通知', time: '2025-7-01 12:00', content: '本周六将举行一场线下活动，期待您的参与！' }
    ];
    return messages.find(msg => msg.id == id);
  }
});
wx.request({
  url: 'https://your.api/messages', 
  method: 'GET',
  data: {
    userId: '123'
  },
  success: (res) => {
    console.log(res.data);
    this.setData({ messages: res.data });
  },
  fail: (err) => {
    console.error(err);
  }
});